@extends('layout.admin.index')
<?php $left_selected = '角色管理';  $center_selected = isset($role)?'角色修改':'角色添加'?>
@section('main')
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>{{  isset($role)?  '角色修改':  '角色添加' }}</span>
    </div>

    @if (count($errors) > 0)
          <div class="mws-form-message error">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <div class="mws-panel-body no-padding">
        <form action="{{route('admin.role.createOrSave',['id' => isset($role->id)?$role->id:''])}}" method="post" class="mws-form">
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <input type="hidden" name="_method" value="put">

            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">角色名称</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="username" value="{{isset($role)? $role->username:'' }}">
                    </div>
                </div>
                 <div class="mws-form-row bordered">
                    <label class="mws-form-label">状态</label>
                    <div class="mws-form-item clearfix">
                        <ul class="mws-form-list inline">

                            <li><input type="radio" name="status" 
                           {{ isset($role)?(($role->status == 1)?"checked":""):"" }}
                            value="1"> <label>启用</label></li>

                            <li><input type="radio" name="status"
                           {{ isset($role)?(($role->status == 0)?"checked":""):"" }}
                            value="2"> <label>禁用</label></li>
                        </ul>
                    </div>
                </div>
              
            <div class="mws-button-row">
               
                <input type="submit" class="btn btn-danger" value="保存">
                <input type="reset" class="btn " value="重置">
            </div>
        </form>
    </div>
</div>
@endsection